package com.gainloop.Api.Entity;

import java.util.Date;

import com.gainloop.Api.ApiException;
import com.google.gson.annotations.SerializedName;

public class UserFriend extends EntityAbstract {
	
	public static final int MAX_TAG_LENGTH = 15;

	@SerializedName("userId")
	private long _userId;
	
	@SerializedName("friendId")
	private long _friendId;
	
	@SerializedName("createTime")
	private long _createTime;
	
	@SerializedName("friendHelpsNum")
	private long _friendHelpsNum;
	
	@SerializedName("friendResolvedNum")
	private long _friendResolvedNum;
	
	@SerializedName("lastChangeTime")
	private long _lastChangeTime;
	

	public long getUserId()
	{
		return this._userId;
	}
	
	public void setUserId(long userId)
	{
		if(userId < 0) {
			throw new ApiException("userId must be unsigned");
		} else if(userId == 0) {
			throw new ApiException("userId must be set");
		}
		
		this._userId = userId;
	}

	public long getFriendId()
	{
		return this._friendId;
	}
	
	public void setFriendId(long friendId)
	{
		if(friendId < 0) {
			throw new ApiException("friendId must be unsigned");
		} else if(friendId == 0) {
			throw new ApiException("friendId must be set");
		}
		
		this._friendId = friendId;
	}
	
	public Date getCreateTime()
	{
		return new Date(this._createTime * 1000);
	}
	
	public long getFriendHelpsNum()
	{
		return this._friendHelpsNum;
	}
	
	public long getFriendResolvedNum()
	{
		return this._friendResolvedNum;
	}
	
	public Date getLastChangeTime()
	{
		return new Date(this._lastChangeTime * 1000);
	}
	
	public String toString()
	{
		return "Friend[" + this._userId + " friend of " + this._friendId + "]";
	}
}
